package com.wuyi.tea.config;

import com.wuyi.tea.domain.vo.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author 30793
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandlerConfig {

    @ExceptionHandler(value = RuntimeException.class)
    public R handler(RuntimeException exception){

        log.error("发生异常:{}",exception.getMessage());
        return R.fail(exception.getMessage());
    }
}
